// pages/feedback/index.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    tabButtonList: [
      {
        id: 0,
        value: '体验问题',
        isCurrent: true
      },
      {
        id: 1,
        value: '商品、商家投诉',
        isCurrent: false
      }
    ],
    imageSrcData: []
  },
  handelCurrent (e) {
    const { id } = e.detail
    const { tabButtonList } = this.data
    tabButtonList.forEach((item, i) => {
      if (i === id) {
        item.isCurrent = true
      } else {
        item.isCurrent = false
      }
    })
    this.setData({
      tabButtonList
    })
  },
  uploadImg () {
    wx.chooseImage({
      count: 9,
      sizeType: ['original', 'compressed'],
      sourceType: ['album', 'camera'],
      success: (result) => {
        this.setData({
          imageSrcData: [...this.data.imageSrcData, ...result.tempFilePaths]
        })
      }
    });
  },
  removeImag (e) {
    const { src } = e.currentTarget.dataset
    const { imageSrcData } = this.data
    const index = imageSrcData.findIndex(v => v == src)
    imageSrcData.splice(index,1)
    this.setData({
      imageSrcData
    })
  }
})